package com.four.controller;

import com.four.pojo.Car_ps;
import com.four.pojo.Product;
import com.four.pojo.Service;
import com.four.pojo.Staff;
import com.four.service.IProductService;
import com.four.service.impl.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author 于志豪
 * @create 2021-10-24 20:37
 */

@Controller
public class ServiceController {
    @Autowired
    @Qualifier("serviceServiceImpl")
    private ServiceServiceImpl service;//服务

    @Autowired
    @Qualifier("car_psServiceImpl")
    private Car_psServiceImpl car_psService;//车属性

    @Autowired
    @Qualifier("staffSerImpl")
    private StaffSerImpl staffSer;//员工

//    @Autowired
//    @Qualifier("productService")
//    private ProductServiceImpl iProductService;//商品

    @Autowired
    @Qualifier("ordersSerImpl")
    private OrdersSerImpl ordersSer;

    @RequestMapping("/findSPXs")
    public String findSPXs(Model model){
//        List<Product> allProduct = iProductService.findAllProduct();
//        model.addAttribute("allProduct",allProduct);

        List<Product> allSP = ordersSer.findAllSP();
        model.addAttribute("allSP",allSP);

        List<Staff> xs1 = staffSer.findXS();
        model.addAttribute("xs1",xs1);
        return "choose_Goods.jsp";
    }


    @RequestMapping("/findCar")//车属性

    //选择服务
    public String findCar (Model model){
        List<Car_ps> car_ps = car_psService.findCar_ps();//车属性
        model.addAttribute("car_ps",car_ps);

        List<Service> all = service.findAll();
        model.addAttribute("all",all);//服务下拉

        List<Staff> Serxs = staffSer.findXS();//销售
        List<Staff> Sersg = staffSer.findSG();//岗位
        model.addAttribute("Serxs",Serxs);
        model.addAttribute("Sersg",Sersg);
        return "/choose_Serve.jsp";
    }



}
